<template>
  <div id="activeAnalysis">
    <h1 class="con-right-title">
      活跃分析
    </h1>
    <div class="table-conBtn">
      <el-radio-group v-model="componentsName">
        <el-radio-button
          v-for="item in typeList"
          :label="item.dictValue"
          :key="item.dictValue"
        >
          {{ item.dictLabel }}</el-radio-button
        >
      </el-radio-group>
    </div>
    <component v-bind:is="componentsName" :powerAry="powerAry"></component>
  </div>
</template>

<script>
import echartsList from '@component/dataStatistics/activityAnalysis/com/echarts' // 图表
import tableList from '@component/dataStatistics/activityAnalysis/com/table' // 表格
import { saveScrollMixins } from '@/mixins/saveScroll'
import { getCreateTime } from '@utils/pubFunction'
export default {
  name: 'analyse',
  msg: '活跃分析',
  components: {
    echartsList,
    tableList
  },
  data() {
    return {
      componentsName: 'echartsList',
      typeList: [
        { dictLabel: '图表', dictValue: 'echartsList' },
        { dictLabel: '明细', dictValue: 'tableList' }
      ],
      powerStr: 'system:activeAnalysis:list', // 是否查询的标识
      canGetList: true, // 是否可以查询列表
      powerAry: [], // 可显示的权限
      canShowPage: false // 是否显示当前页面
    }
  },
  mounted() {
    // 获取权限
    // this.getPower()
  },
  methods: {
    /* 获取权限 */
    getPower() {
      let id = this.$route.query.mId
      this.getCurPageMenu(id).then((res) => {
        this.powerAry = res
        if (!res.includes(this.powerStr)) {
          this.canGetList = false
          this.alertPower(this.powerStr)
        } else {
          this.canShowPage = true
        }
      })
    }
  }
}
</script>

<style lang="less">
#activeAnalysis {
  .el-radio-button__inner {
    padding: 8px 20px;
  }
  .echarts-title {
    font-size: 18px;
    font-weight: bold;
    color: #222;
    padding: 10px 0 10px 30px;
  }
  .search-box {
    margin-bottom: 0px !important;
  }
}
</style>
